<?php
namespace Modules\Activity\Http\Controllers\Client\Fudai;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

use \Modules\Asset\Entities\PackageSku;

use Validator;
use ThrowException;
use Auth;
use DB;
use Cache;
use Setting;

// 一番赏活动
class RankController extends Controller
{
    // 榜单
    public function index(Request $req, $uuid)
    {
        $cacheKey = 'rank_' . $uuid;

        $res = Cache::get($cacheKey);

        if (!$res) {

            $list = PackageSku::getList([
                'with' => ['user'],
                'where' => [
                    'node_uuid' => $uuid,
                    ['sku_level', '>', 1]
                ],
                'per_page' => 100
            ]);

            $res = $list->generateListResponse();

            Cache::put($cacheKey, $res, 8);
        }

        return $res;
    }

}
